package User;

import Book.BookList;
import Scanner.ScannerIdentity;
import Scanner.ScannerName;

public class Main {

    public static User login() {
        System.out.println("请输入你的名字：");
        ScannerName scannerName = new ScannerName();
        String name = scannerName.setName();
        System.out.println("欢迎 "+name+" 来到图书管理系统");

        System.out.println("请输入你的身份：");
        System.out.println("1.普通用户     2.管理员");
        ScannerIdentity scannerIdentity = new ScannerIdentity();
        int choiceIdentity = scannerIdentity.setIdentity();
        if(choiceIdentity == 1) {
            return new NormalUser(name);
        }else if (choiceIdentity == 2) {
            return new ManageUser(name);
        }else {
            return null;
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();

        while (true) {
            int choice = user.meun();
            User.doOpertion(choice,bookList);
        }

    }

}
